package com.newcoder.alibaba;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;

public class Mook005 {

    public static ArrayList<ArrayList<Integer>> res = new ArrayList<>();
    public static ArrayList<Integer> path = new ArrayList<>();

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] params = br.readLine().trim().split(" ");
        int n = Integer.parseInt(params[0]), m = Integer.parseInt(params[1]);
        dfs(n, m, 1);
        for(ArrayList<Integer> items: res){
            for(Integer elem : items){
                System.out.print(elem + " ");
            }
            System.out.println();
        }
    }

    private static void dfs(int n, int m, int index) {
        if(path.size() == m){
            res.add(new ArrayList<>(path));
            return;
        }
        for(int i = index; i <= n; i++){
            path.add(i);
            dfs(n, m, i + 1);
            path.remove(path.size() - 1);
        }
    }
}